package leetcode;

import java.util.Stack;

/**
 * @author Liangyaoyun
 */
public class MyQueue {
    Stack<Integer>inStack;
    Stack<Integer>outStack;
    public MyQueue() {
    inStack=new Stack<>();
    outStack=new Stack<>();
    }

    public void push(int x) {
        inStack.push(x);
    }

    public int pop() {
        if (!inStack.isEmpty()){
            outStack.push(inStack.pop());
        }
        return outStack.pop();
    }

    public int peek() {
        if (!inStack.isEmpty()){
            outStack.push(inStack.pop());
        }
        return outStack.peek();
    }

    public boolean empty() {
        if (outStack.isEmpty()){
            return true;
        }
        else  {
            return  false;
        }
    }
}
